package com.yanqu.road.logic.pb;

import com.yanqu.road.entity.activity.xiuxian.data.CrossXiuXianPvpPosition;
import com.yanqu.road.entity.enums.kuang.eKuangAttributeType;
import com.yanqu.road.entity.kuang.battle.CrossKuangBattlePosition;
import com.yanqu.road.entity.kuang.battle.CrossKuangBattleUserData;
import com.yanqu.road.entity.kuang.group.KuangMatchGroup;
import com.yanqu.road.pb.activity.XiuXianProto;
import com.yanqu.road.pb.kuang.Kuang;

public class CrossKuangPb {

    public static Kuang.KuangMatchGroupTemp.Builder parseKuangMatchGroupTemp(KuangMatchGroup matchGroup) {
        if (matchGroup == null) {
            return null;
        }
        Kuang.KuangMatchGroupTemp.Builder builder = Kuang.KuangMatchGroupTemp.newBuilder();
        builder.setWeekId(matchGroup.getWeekId());
        builder.setGroupId(matchGroup.getGroupId());
        builder.setOpenDay(matchGroup.getOpenDay());
        builder.addAllServerIdList(matchGroup.getServerIdList());
        builder.setCrossId(matchGroup.getCrossId());
        return builder;
    }

    public static KuangMatchGroup parseKuangMatchGroup(Kuang.KuangMatchGroupTemp temp) {
        KuangMatchGroup matchGroup = new KuangMatchGroup();
        matchGroup.setWeekId(temp.getWeekId());
        matchGroup.setGroupId(temp.getGroupId());
        matchGroup.setOpenDay(temp.getOpenDay());
        matchGroup.setServerIdList(temp.getServerIdListList());
        matchGroup.setCrossId(temp.getCrossId());
        return matchGroup;
    }

    public static Kuang.AttributeDataTemp.Builder parseAttributeDataTemp(Kuang.AttributeEnum attributeEnum, long value) {
        Kuang.AttributeDataTemp.Builder builder = Kuang.AttributeDataTemp.newBuilder();
        builder.setType(attributeEnum);
        builder.setValue(value);
        return builder;
    }

    public static CrossKuangBattlePosition parseCrossKuangBattlePosition(Kuang.KuangBattlePositionTemp temp) {
        CrossKuangBattlePosition position = new CrossKuangBattlePosition();
        position.setX(temp.getX());
        position.setY(temp.getY());
        position.setDirX(temp.getDirX());
        position.setDirY(temp.getDirY());
        position.setTime(temp.getTime());
        return position;
    }

    public static Kuang.AttributeEnum parseAttributeEnum(eKuangAttributeType type) {
        return Kuang.AttributeEnum.valueOf(type.getValue());
    }

}
